﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Steer
{
    public partial class PathTest : UserControl
    {
        private List<Vector2D> _path;
        
        public PathTest()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(PathTest_Loaded);
        }

        void PathTest_Loaded(object sender, RoutedEventArgs e)
        {
            _path = new List<Vector2D>();
            LayoutRoot.MouseLeftButtonUp += new MouseButtonEventHandler(LayoutRoot_MouseLeftButtonUp);
            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
        }

        void CompositionTarget_Rendering(object sender, EventArgs e)
        {
            myTarget.followPath(_path, true);
            myTarget.update();
        }

        void LayoutRoot_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            _path.Add(new Vector2D(e.GetPosition(null).X, e.GetPosition(null).Y));
        }
    }
}
